class Vacation {
  static constraints = {
    startDate(blank:false, nullable:false)
    endDate(blank:false, nullable:false)
    description()
  }

  def getDuration(){ 
    return endDate - startDate + 1
  }

  def getDates(dateDecorator = { it }){
    def dates = new HashSet()
    (this.startDate..this.endDate).each{
      dates.add(dateDecorator(it))
    }
    return dates
  }

  Date startDate
  Date endDate
  String description
}
